//who got it from Raphael Jolivet's smart-cursor v0.2
// Get Style Sheet service
var sss = Components.classes["@mozilla.org/content/style-sheet-service;1"].getService(Components.interfaces.nsIStyleSheetService);
// Get IO service
var ios = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
// Build URI
var uri = ios.newURI(href, null, null);
// Register sheet
sss.loadAndRegisterSheet(uri, sss.USER_SHEET);
}
interclue.unregisterStylesheet = function(href){
var sss = Components.classes["@mozilla.org/content/style-sheet-service;1"].getService(Components.interfaces.nsIStyleSheetService);
var ios = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
var uri = ios.newURI(href, null, null);
sss.unregisterSheet(uri, sss.USER_SHEET);
}
interclue.inArray = function(needle, haystack){
for (var i=0; i<haystack.length; i++){
if (haystack[i] == needle){
return true;
}
}
return false;
}
/**
* load our scripts into the iframe
*/
interclue.initClueBridge = function(){
if (!interclue.inArray("platform-firefox.js", interclue.scripts)){
interclue.scripts.push("platform-firefox.js");
}
//scripts must be loaded using a file:// path
// SiteHound installs Interclue into the Browser/extensions directory.
// however we install to the user's extension dir.
var dirGetId = (interclue.isSiteHound) ? "CurProcD" : "ProfD";
//however I like to keep sitehound away from my install directory.
if (interclue.isProfileDir){
dirGetId = "ProfD";
}
var dir = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get(dirGetId, Components.interfaces.nsILocalFile).path;
var doc = document.getElementById('interclue-iframe').contentWindow.document;
var fileUrl = "file:///"+ dir.replace(/\\\//g, '/') +"/extensions/" + interclue.GUID +"/chrome/interclue/content/cluecore/";
* return TRUE is operating system is Windows based (NT, 2000, XP, Vista)
*/
interclue.isWindows = function(){
return (interclue.getOS() == "WINNT");
}
/**
* return TRUE is file exists
*/
interclue.fileExists = function(path){
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(path);
return file.exists();
}
/**
* creates a temporary file and writes the given data to it
* returns the path to the temporary file
*/
interclue.writeTempFile = function(data){
var file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("TmpD", Components.interfaces.nsIFile);